package lazy2.util;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;

public class FileTree {
	private List<File> files = new ArrayList<File>();
	private void listFiles(File file) {
		if(file.isDirectory()) {
			for(File f:file.listFiles()) {
				listFiles(f);
			}
		} else if(file.isFile()) {
			files.add(file);
		}
	}
	public void changeFileRoot(File root) throws FileNotFoundException {
		if(!root.exists()) throw new FileNotFoundException();
		files.clear();
		listFiles(root);
	}
	public List<File> getFiles() {
		return new ArrayList<File>(files);
	}
}
